<!--
 * @Author: wangyongcun@persagy.com
 * @Date: 2025-03-15 10:20:49
 * @LastEditTime: 2025-03-23 10:26:02
 * @FilePath: \vite-admin\src\components\common\TipIcon.vue
 * @Description:
 *
-->
<template>
  <el-tooltip
    :content="tooltipContent"
    :disabled="!showTooltip"
    :placement="tooltipPlacement"
  >
    <el-button
      class="text-icon cursor-pointer mx-0!"
      text
      quaternary
      @click="emitClick"
    >
      <Icon
        class="w-5 h-5 cursor-pointer select-none"
        :icon="icon"
        :key="icon"
      />
      <slot></slot>
    </el-button>
  </el-tooltip>
</template>

<script setup lang="ts">
interface Props {
  showTooltip?: boolean;
  tooltipContent?: string;
  tooltipPlacement?: string;
  icon?: string;
}
withDefaults(defineProps<Props>(), {
  showTooltip: false,
  tooltipPlacement: "bottom",
});

const emit = defineEmits(["click"]);
const emitClick = () => {
  emit("click");
};
</script>
